# 1.索引
str_python = "python"
str_python[0]   #使用正向索引获取字符p
str_python[-6]  #使用反向索引获取字符p
# 2.切片
str_python = "python"
result_one = str_python[0:4]   #索引为0处开始，到索引为4处结束，步长为1
print(result_one)
result_two = str_python[0:4:2] #索引为0处开始，到索引为4处结束，步长为2
print(result_two)

#索引为3处开始，到索引为0处结束，步长为-1
result_thr = str_python[3:0:-1]
print(result_thr)
#索引为-1处开始，到索引为-6处结束，步长为-2
result_fou = str_python[-1:-6:-2]
print(result_fou)

